import {debug01, pixel01} from '@/role/debug'
import {harvest01,harvest02} from '@/role/harvest'
import {vindicat01} from '@/role/vindicat'
import {repair01, repair02} from '@/role/repair'
import {GenerateAbility, isInArray} from "@/utils"
export function role_filter(role_name:string[]):DicRoleData
{
    if (!global.DicCreepFrameControl) global.DicCreepFrameControl = {}
    var temp_dic:DicRoleData = {}
    // role信息
    let role_ : DicRoleData = {
        /* 基本单位 */
        "transport01":
        {work:'transport01',num:0,ability:GenerateAbility(1,1,2),controlByFrame:false,must:true},
        "manage01":
        {work:'manage01',num:0,ability:GenerateAbility(1,1,2),controlByFrame:false,must:true},
        /* 非任务控制 */
        "repair01":
        {work:'repair01',fun:repair01,num:0,ability:GenerateAbility(2,2,4),controlByFrame:false},
        "repair02":
        {work:'repair02',fun:repair02,num:0,ability:GenerateAbility(2,2,4),controlByFrame:true},
        "vindicat01":
        {work:'vindicat01',fun:vindicat01,num:0,ability:GenerateAbility(1,1,2),controlByFrame:true},
        "upgrade01":
        {work:'upgrade01',fun:debug01,num:0,ability:GenerateAbility(1,2,2),controlByFrame:true},
        "harvest01":
        {work:'harvest01',fun:harvest01,num:0,ability:GenerateAbility(1,1,2),controlByFrame:true,must:true},
        "harvest02":
        {work:'harvest02',fun:harvest02,num:0,ability:GenerateAbility(1,1,2),controlByFrame:true,must:false},
        "pixel":
        {work:'pixel',fun:pixel01,num:0,ability:GenerateAbility(0,0,1),controlByFrame:true,must:false},
        /* 以下皆为自动挂载 非框架控制的都自动挂载 */
        "miner":
        {work:'miner',num:0,ability:GenerateAbility(1,1,2),controlByFrame:false},
        "geez-attack":
        {work:'geez-attack',num:0,ability:GenerateAbility(0,0,6,6),controlByFrame:false},
        "geez-heal":
        {work:'geez-heal',num:0,ability:GenerateAbility(0,0,6,0,0,6),controlByFrame:false},
        "power-attack":
        {work:'power-attack',num:0,ability:GenerateAbility(0,0,20,20),controlByFrame:false},
        "power-heal":
        {work:'power-heal',num:0,ability:GenerateAbility(0,0,25,0,0,25),controlByFrame:false},
        "power-carry":
        {work:'power-carry',num:0,ability:GenerateAbility(0,25,25),controlByFrame:false},
        "geez-work":
        {work:"geez-work",num:0,ability:GenerateAbility(1,0,1),controlByFrame:false},
        "pillage":
        {work:'pillage',num:0,ability:GenerateAbility(0,4,4),controlByFrame:false},
        'e-claimer':
        {work:'e-claimer',num:0,ability:GenerateAbility(0,0,1,0,0,0,1),controlByFrame:false},
        'e-upgrader':
        {work:'e-upgrader',num:0,ability:GenerateAbility(1,1,2),controlByFrame:false},
        'e-builder':
        {work:'e-builder',num:0,ability:GenerateAbility(1,1,2),controlByFrame:false},
        'scout':
        {work:'scout',num:0,ability:GenerateAbility(0,0,1),controlByFrame:false},
        'out-car':
        {work:'out-car',num:0,ability:GenerateAbility(0,1,1),controlByFrame:false},
        'out-min':
        {work:'out-min',num:0,ability:GenerateAbility(1,1,2),controlByFrame:false},
        'out-claim':
        {work:'out-claim',num:0,ability:GenerateAbility(0,0,2,0,0,0,2),controlByFrame:false},
        'out-defend':
        {work:'out-defend',num:0,ability:GenerateAbility(0,0,1,0,1,1),controlByFrame:false},
        // 冲级者
        'i-upgrader':
        {work:'i-upgrader',num:0,ability:GenerateAbility(1,1,2,0,0,0),controlByFrame:false},
        // 攻防一体机
        'ADIM':
        {work:'ADIM',num:0,ability:GenerateAbility(0,0,1,0,1,1,0,1),controlByFrame:false},
        'DSIM':
        {work:'DSIM',num:0,ability:GenerateAbility(11,0,10,0,0,18,0,11),controlByFrame:false},
        // boost 刷墙
        "Brepair":
        {work:'Brepair',num:0,ability:GenerateAbility(15,20,15),controlByFrame:false,must:true},
        // 防御红球
        "defend-red":
        {work:'defend-red',num:0,ability:GenerateAbility(0,0,10,40),controlByFrame:false},
        // 拆迁黄球
        "dismantle-yellow":
        {work:'dismantle-yellow',num:0,ability:GenerateAbility(40,0,10),controlByFrame:false},
    }
    for (var j of Object.keys(role_))
    {
        if (role_[j].controlByFrame == true)
        {
            if (isInArray(role_name,j))
            temp_dic[j] = role_[j]
        }
        else
        {
            // 非框架控制自动挂载
            temp_dic[j] = role_[j]
            // temp_dic[j].num = 0
        }
        // if (role_[j].work == 'scout')
        //     console.log('role_filter:',role_[j].num)
    }
    return temp_dic
}

export const Framerole = {
        "repair02":
        {work:'repair02',fun:repair02,num:0,ability:GenerateAbility(2,2,4),controlByFrame:true},
        "vindicat01":
        {work:'vindicat01',fun:vindicat01,num:0,ability:GenerateAbility(1,1,2),controlByFrame:true},
        "upgrade01":
        {work:'upgrade01',fun:debug01,num:0,ability:GenerateAbility(1,2,2),controlByFrame:true},
        "harvest01":
        {work:'harvest01',fun:harvest01,num:0,ability:GenerateAbility(1,1,2),controlByFrame:true,must:true},
        "harvest02":
        {work:'harvest02',fun:harvest02,num:0,ability:GenerateAbility(1,1,2),controlByFrame:true,must:false},
        "pixel":
        {work:'pixel',fun:pixel01,num:0,ability:GenerateAbility(0,0,1),controlByFrame:true,must:false},
    }